package com.xuzimian.globaldemo.office.excel;

import java.io.IOException;
import java.util.List;

import com.google.common.collect.Lists;
import com.xuzimian.globaldemo.office.excel.pojo.ExcelCellData;
import com.xuzimian.globaldemo.office.excel.util.ExcelUtil;

/**
 * 大隐Excel辅助类
 * 
 * @author xuzimian
 */
public class DyExcelAuxiliaryDemo {

    public static void main(String[] args) throws IOException {
        test();
    }

    public static void test() throws IOException {
        String tempFilePath = ExcelUtil.class.getClassLoader().getResource("模板.xlsx").getPath();
        tempFilePath=   java.net.URLDecoder.decode(tempFilePath, "utf-8");
        ExcelUtil.copyExcelWorkBookAndFillData(tempFilePath, "C:\\Users\\xuzim\\Desktop\\复制版.xlsx", getExcelCellDatas());
     }

    private static List<ExcelCellData> getExcelCellDatas() {
        List<ExcelCellData> excelCellDatas = Lists.newArrayList();
        ExcelCellData excelCellData = new ExcelCellData();
        excelCellData.put("所在数据库", "db_demo");
        excelCellData.put("中文名", "交易表");
        excelCellData.put("对象号", "1234");
        excelCellData.put("表名", "transaction");
        excelCellData.put("字段", "字类型", "varchar");
        excelCellData.put("字段", "字段说明", "这是字段1说明");
        excelCellData.put("字段", "字段", "字段1");
        excelCellData.put("字段", "字段注释", "这是字段1注释");
        excelCellData.put("说明", "我是说明");
        excelCellData.put("索引", "索引名称", "id_pdx");
        excelCellData.put("索引", "唯一", "Y");
        excelCellData.put("索引", "索引字段", "pdx");

        ExcelCellData excelCellData2 = new ExcelCellData();
        excelCellData2.put("所在数据库", "db_demo");
        excelCellData2.put("中文名", "交易明细表");
        excelCellData2.put("对象号", "123");
        excelCellData2.put("表名", "transactiondetail");
        excelCellData2.put("字段", "字类型", "varchar");
        excelCellData2.put("字段", "字段说明", "这是字段2说明");
        excelCellData2.put("字段", "字段", "字段2");
        excelCellData2.put("字段", "字段注释", "这是字段2注释");
        excelCellData2.put("说明", "我是说明");
        excelCellData2.put("索引", "索引名称", "id_pdx");
        excelCellData2.put("索引", "唯一", "Y");
        excelCellData2.put("索引", "索引字段", "pdx");

        excelCellDatas.add(excelCellData);
        excelCellDatas.add(excelCellData2);

        return excelCellDatas;
    }

}